package com.file.system.entity.system;


import com.file.system.entity.basic.WebBasic;
import com.file.system.plugin.dict.Dict;
import com.file.system.plugin.validated.SQLInjectionValidation;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.*;
import javax.validation.groups.Default;
import java.io.Serializable;


/**
 * 字典
 *
 * @author jch
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class WebDictionary extends WebBasic implements Serializable {

    private static final long serialVersionUID = 1L;


    //新增
    public interface add extends Default {
    }

    //修改
    public interface update extends Default {
    }

    /**
     * 主键
     *
     * @mock
     */
    @NotNull(groups = {update.class}, message = "主键不能为空")
    @Min(value = 1, message = "id长度最小1")
    private Long id;
    /**
     * 名称
     *
     * @mock
     */
    @NotEmpty(groups = {update.class, add.class}, message = "名称不能为空")
    @Size(min = 1, max = 50, message = "名称长度1-50")
    @SQLInjectionValidation(fieldName = "名称")
    private String name;
    /**
     * 编码
     *
     * @mock
     */
    @NotEmpty(groups = {update.class, add.class}, message = "编码不能为空")
    @Size(min = 1, max = 20, message = "编码长度1-20")
    @SQLInjectionValidation(fieldName = "编码")
    private String code;
    /**
     * 排序
     *
     * @mock
     */
    @NotNull(groups = {add.class, update.class}, message = "排序不能为空")
    @Min(value = 1, message = "排序最小1")
    @Max(value = 2000, message = "排序最大2000")
    private Integer sort;
    /**
     * 字典分类（字典）
     *
     * @mock
     */
    @NotEmpty(groups = {update.class, add.class}, message = "分类不能为空")
    @Size(min = 1, max = 20, message = "分类长度1-20")
    @Dict("dictGroup")
    @SQLInjectionValidation(fieldName = "分类")
    private String dictGroup;
    /**
     * 列表或树（字典）
     *
     * @mock
     */
    @NotEmpty(groups = {update.class, add.class}, message = "列表或树不能为空")
    @Size(min = 1, max = 20, message = "列表或树长度1-20")
    @Dict("listOrTree")
    @SQLInjectionValidation(fieldName = "列表或树")
    private String dictListOrTree;
    /**
     * 备注
     *
     * @mock 备注
     */
    private String description;
}
